package org.happy.tester.common.http.req;

import org.happy.tester.common.model.MockResultDO;
import org.happy.tester.common.model.PointcutDO;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @Classname MockResultRequest
 * @Description TODO
 * @Date 2020/6/29 6:28 下午
 * @Created by jc.bai
 */
public class MockResultRequest {

    private String appIp;

    private String clientIp;

    private List<MockResultDO> mockResultDOList;

    @Override
    public String toString() {
        return "MockResultRequest{" +
                "appIp='" + appIp + '\'' +
                ", clientIp='" + clientIp + '\'' +
                ", mockResultDOList=" + mockResultDOList +
                '}';
    }

    public String getAppIp() {
        return appIp;
    }

    public void setAppIp(String appIp) {
        this.appIp = appIp;
    }

    public String getClientIp() {
        return clientIp;
    }

    public void setClientIp(String clientIp) {
        this.clientIp = clientIp;
    }

    public List<MockResultDO> getMockResultDOList() {
        return mockResultDOList;
    }

    public void setMockResultDOList(List<MockResultDO> mockResultDOList) {
        this.mockResultDOList = mockResultDOList;
    }

    public PointcutRequest convertToPointcutRequest() {
        PointcutRequest pointcutRequest = new PointcutRequest();
        pointcutRequest.setAppIp(this.appIp);
        pointcutRequest.setClientIp(this.clientIp);
        List<PointcutDO> pointcutDOS = this.mockResultDOList.stream().map(MockResultDO::getPointcutDO).collect(Collectors.toList());
        pointcutRequest.setPointcutDOS(pointcutDOS);
        return pointcutRequest;
    }
}
